<template>
	<base-page>
		<view slot="header">
			<!-- #ifdef MP-WEIXIN -->
			<cu-custom :isBack="true" bgColor="bg-white" :backSolt="true">
				<block slot="backbox">
					<view class="df-ai-cen">
						<text class="lg cuIcon-back text-gray margin-right" @click="Back"></text>
						<view class="addMore" @click="goAddDetail">添加</view>
					</view>
				</block>
				<block slot="content">我的收货地址</block>
			</cu-custom>
			<!-- #endif -->
			<!-- #ifdef H5 -->
			<block>
				<cu-custom :isBack="true" bgColor="bg-white">
					<block slot="content">我的收货地址</block>
					<block slot="right"><view class="addMore" @click="goAddDetail">添加</view></block>
				</cu-custom>
			</block>
			<!-- #endif -->
		</view>
		<view slot="center" class="auto-100 content-wrapper bg-gray">
			
			<view class="wrapper bg-white"><AddressList :addList="addList"></AddressList></view>
			<view class="txt" v-if="addList.length == 0">空空如也~~</view>
		</view>
	</base-page>
</template>

<script>
import AddressList from './components/AddressList';
import { getMemberaddress } from '@/common/js/request/modules/public.js';

export default {
	data() {
		return {
			addList: [],
			backUrl: ''
		};
	},
	components: {
		AddressList
	},
	onLoad(e) {
		// this.backUrl = this.$Router.queryObj().backUrl;
	},
	onShow(e) {
		this.getAddress();
	},
	methods: {
		Back() {
			this.$Utils.compatiBleJump({ key: 'exit' }, 1);
		},
		goAddDetail() {
			this.$Router.push({
				path: '/publicPages/setup/changeaddress'
			});
		},
		getAddress() {
			getMemberaddress().then(res => {
				this.addList = res.list;
			});
		}
	},
	mounted() {}
};
</script>

<style lang="scss">
.addMore {
	padding-right: 10px;
}
.wrapper {
	padding: 0 15px;
	position: relative;
	overflow: auto;
	height: 100%;
}
.txt {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 18px;
	color: lightgrey;
}
</style>
